#include <iostream>
#define ll long long

using namespace std;

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int t;
	cin >> t;
	while(t--){
		int x,y;
		cin >> x >> y;
		if((y+x) & 1){
			cout << -1;
			if(t) cout << endl;
			continue;
		}
		ll a = 2;
		int step = 1;
		
		if(y < x){
			int temp = y;
			y = x;
			x = temp;
		}
		
		if(y % x == 0 && ((y / x) & 1)){
			while(a < y/x + 1){
				a *= 2ll;
				++step;
			}
			if(a == y/x + 1){
				cout << step;
			}else{
				cout << -1;
			}
		}else{
			cout << -1;
		}
		
		if(t) cout << endl;
	}

	return 0;
}

